<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>

<%@include file="/common/head.jsp" %>

<c:set var="module" value="user"/>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form role="form" class="form-inline" id="query-form" method="get" action="${ctx }/admin/user/list" >
                        <!-- 查询开始 -->
                        <input type="hidden" name="type" value="${type }" />
                        <input type="hidden" name="fromType" value="${fromType }" />
                        <div class="form-group">
                            <label form="query-user" class="sr-only">用户</label>
                            <input type="text" placeholder="用户名、昵称或手机" name="searchTerm" value="${query.searchTerm }" class="form-control"/>
                        </div>
                        <div class="form-group">
                            <button class="btn btn-primary form-control" type="submit"><i class="fa fa-check"></i>&nbsp;查询</button>
                        </div>
                        <!-- 查询结束 -->
                    </form>

                    <table id="table" data-toggle="table" data-height="400" data-click-to-select="true" data-mobile-responsive="true">
                        <thead>
                        <tr>
                            <th data-field="_state" data-radio="true"></th>
                            <th data-field="id" data-visible="false">id</th>
                            <th data-field="user" >id</th>
                            <th data-field="type">类型</th>
                            <th data-field="username">用户名</th>
                            <th data-field="nickName">昵称</th>
                            <th data-field="email">邮箱</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${list }" var="n" varStatus="idx">
                            <tr data-index="${idx.index }" data-id="${n.id }">
                                <td></td>
                                <td></td>
                                <td style="">${n.id }</td>
                                <td style="">${enum:list('UserType', n.type)}</td>
                                <td style="">${n.username }</td>
                                <td style="">${n.nickName }</td>
                                <td style="">${n.email }</td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>

                    <%@include file="/common/page.jsp" %>


                </div>
            </div>
        </div>
    </div>
</div>

<%@include file="/common/foot.jsp" %>

<script>

    var page = "${page.page}";
    function reload() {
        page_submit(page);
    }

    paging('pagination', ${page.totalPages}, ${page.page});

</script>
</body>
</html>